//author:kakake
class tsMenuService {
    public data = {
        dbConn: TSLobsterAPI.Program.GetDbConn(),
        WorkId: 1
    }

    public dao: tsMenuDao;

    constructor(workid: number) {
        this.data.WorkId = workid;
        this.dao = new tsMenuDao(this.data.WorkId);
    }

    /**递归添加勾选菜单的父级分类菜单 */
    addPMenuId(groupId, menuId) {
        let pid: number = parseInt(this.dao.getMenuPId(menuId));
        let exist: boolean = this.dao.getIsGroupMenu(groupId, menuId);
        if (pid != -1 && exist == false) {
            this.dao.saveUserWorkGroup(groupId, menuId);
            this.addPMenuId(groupId, pid);
        }
    }
}